<?php
namespace Api\Controller;
use Think\Controller;
class MoodController extends Controller{
    public function index()
    {
        echo 'Mood';

    }
//创建心情
    public function createmood(){
        if(isset($_POST['mood_content']) && !empty($_POST['mood_content'])){
            $con = M('mood');
            $data['uid'] = $_SESSION['user_id'];
            $data['mood_content'] = I('post.mood_content');
            $result = $con -> add($data);
            if($result){
                echo BaseController::ApiSuccess('发表成功');
            }  else{
                echo BaseController::ApiError('系统繁忙，请重试');
            }
        }
    }

//获取心情
    public function get_mood(){
        if(IS_POST){
            $data['uid'] = $_SESSION['user_id'];
            $con = M('mood');
            $result = $con -> where($data)-> select();
            if($result){
                echo BaseController::ApiSuccess($result);
            }else{
                echo BaseController::ApiError('暂无心情');
            }
        }
    }




}